cmake_minimum_required( VERSION 2.8 )
project("qxmlrpc")
find_package( Qt4 REQUIRED )

ADD_DEFINITIONS(${QT_DEFINITIONS})
ADD_DEFINITIONS(-DQT_PLUGIN)
ADD_DEFINITIONS(-DQT_NO_DEBUG)
ADD_DEFINITIONS(-DQT_SHARED)

include( ${QT_USE_FILE} )
INCLUDE_DIRECTORIES(
    ${QT_INCLUDE_DIR}
    ${QT_QTXML_INCLUDE_DIR}
    ${QT_QTNETWORK_INCLUDE_DIR}
    ${CMAKE_CURRENT_BINARY_DIR}
 )

set( HEADERS
        client.h
		qxmlrpc_documentation.h
		request.h
		response.h
		server.h
		server_private.h
		serverintrospection.h
		stable.h
		variant.h
        )
set( SOURCES 
        client.cpp
		request.cpp
		response.cpp
		server.cpp
		serverintrospection.cpp
		variant.cpp
        )


qt4_wrap_ui(UIS_H ${UIS})

qt4_wrap_cpp(MOC ${HEADERS})

add_library(qxmlrpc SHARED ${SOURCES} ${MOC} 
)

target_link_libraries( qxmlrpc ${QT_LIBRARIES} ${QT_QTXML_LIBRARIES} ${QT_QTNETWORK_LIBRARIES})

# install for linux
if(${CMAKE_SYSTEM_NAME} STREQUAL Linux)
        set(rootdir ${CMAKE_INSTALL_PREFIX})
        set(libdir ${rootdir}/lib)
        install(TARGETS qxmlrpc DESTINATION ${libdir})
endif()

# install for mac
if(${CMAKE_SYSTEM_NAME} STREQUAL Darwin)
        set(rootdir ${CMAKE_INSTALL_PREFIX})
        set(libdir ${rootdir}/lib)
        install(TARGETS qxmlrpc DESTINATION ${libdir})
endif()
